From c24e1900341c2395f13193ab13c81fa1ff8074b1 Mon Sep 17 00:00:00 2001 From: Dirk Farin Date: Sat, 4 Nov 2023 15:13:36 +0100 Subject: [PATCH] check validity of conformance window parameters (fixes #427) (cherry picked from commit 221e767136b8c46c748ae35b79ec9b976b3da301) Gbp-Pq: Name 0013-check-validity-of-conformance-window-parameters-fixe.patch --- libde265/image.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libde265/image.cc b/libde265/image.cc index 39813b0..057705c 100644 --- a/libde265/image.cc +++ b/libde265/image.cc @@ -330,6 +330,14 @@ de265_error de265_image::alloc_image(int w,int h, enum de265_chroma c, int top = sps ? sps->conf_win_top_offset : 0; int bottom = sps ? sps->conf_win_bottom_offset : 0; + if ((left+right)*WinUnitX >= width) { + return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE; + } + + if ((top+bottom)*WinUnitX >= height) { + return DE265_ERROR_CODED_PARAMETER_OUT_OF_RANGE; + } + width_confwin = width - (left+right)*WinUnitX; height_confwin= height- (top+bottom)*WinUnitY; chroma_width_confwin = chroma_width -left-right; -- 2.30.2